import { Controller, Get, Param } from '@nestjs/common'
import { CategoryService } from './category.service'
import { ApiOperation, ApiTags } from '@nestjs/swagger'

@ApiTags('分类')
@Controller('category')
export class CategoryController {
  constructor(private readonly categoryService: CategoryService) {}

  // 分类
  @ApiOperation({ summary: '分类' })
  @Get()
  queryCategory() {
    return this.categoryService.queryCategory()
  }

  // 分类列表
  @ApiOperation({ summary: '分类列表' })
  @Get('subcategory/:maitKey')
  querySubCategory(@Param('maitKey') maitKey: string) {
    return this.categoryService.querySubCategory(maitKey)
  }
}
